package com.k.designpattern.creational.factory.staticfactory;

import java.util.Properties;
import java.util.UUID;

public class UserFactory {
    public static User newTeacherInstance(){
        User u = new User();
        u.setId(UUID.randomUUID().toString());
        u.setType(1);
        u.setName("Unknown");
        return u;
    }
    public static User newStudentInstance(){
        User u = new User();
        u.setId(UUID.randomUUID().toString());
        u.setType(2);
        u.setName("Unknown");
        return u;
    }

    public static User newInstanceProperties(Properties properties){
        String type = properties.getProperty("type");
        User u = new User();
        u.setType(Integer.valueOf(type));
        return u;
    }
}
